<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/limh/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/limh/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/limh/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/limh/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/limh/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/limh/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/limh/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="教程,">










<meta name="description" content="在前面几章，我们分别介绍了用汇编语言进行程序设计所需要的几个最基本的知识：内存单元的寻址方式，变量定义和各种汇编指令格式。在掌握了这些基本内容之后，就需要学习如何把它们组成一个完整的汇编语言程序。 汇编语言源程序的组成部分有：模块、段、子程序和宏等。一个模块对应一个目标文件，当开发较大型的应用程序时，该程序可能由若干个目标文件或库结合而成的。有关模块和子程序的知识和宏在第7章介绍，有关宏的知识将在">
<meta name="keywords" content="教程">
<meta property="og:type" content="article">
<meta property="og:title" content="6.1 源程序的基本组成">
<meta property="og:url" content="https://tdnr.gitee.io/limh/2015/04/01/asm23/index.html">
<meta property="og:site_name" content="土逗牛肉">
<meta property="og:description" content="在前面几章，我们分别介绍了用汇编语言进行程序设计所需要的几个最基本的知识：内存单元的寻址方式，变量定义和各种汇编指令格式。在掌握了这些基本内容之后，就需要学习如何把它们组成一个完整的汇编语言程序。 汇编语言源程序的组成部分有：模块、段、子程序和宏等。一个模块对应一个目标文件，当开发较大型的应用程序时，该程序可能由若干个目标文件或库结合而成的。有关模块和子程序的知识和宏在第7章介绍，有关宏的知识将在">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://www.iteedu.com/plang/asm/asmhbyychxshj/images/clip_image002_0024.gif">
<meta property="og:updated_time" content="2019-01-21T13:59:48.416Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="6.1 源程序的基本组成">
<meta name="twitter:description" content="在前面几章，我们分别介绍了用汇编语言进行程序设计所需要的几个最基本的知识：内存单元的寻址方式，变量定义和各种汇编指令格式。在掌握了这些基本内容之后，就需要学习如何把它们组成一个完整的汇编语言程序。 汇编语言源程序的组成部分有：模块、段、子程序和宏等。一个模块对应一个目标文件，当开发较大型的应用程序时，该程序可能由若干个目标文件或库结合而成的。有关模块和子程序的知识和宏在第7章介绍，有关宏的知识将在">
<meta name="twitter:image" content="http://www.iteedu.com/plang/asm/asmhbyychxshj/images/clip_image002_0024.gif">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/limh/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tdnr.gitee.io/limh/2015/04/01/asm23/">





  <title>6.1 源程序的基本组成 | 土逗牛肉</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans ">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/limh/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">土逗牛肉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/limh/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/limh/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/limh/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/limh/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/limh/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tdnr.gitee.io/limh/limh/2015/04/01/asm23/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="土逗牛肉">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/limh/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="土逗牛肉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">6.1 源程序的基本组成</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-04-01T20:35:48+08:00">
                2015-04-01
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/limh/categories/汇编教程/" itemprop="url" rel="index">
                    <span itemprop="name">汇编教程</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>在前面几章，我们分别介绍了用汇编语言进行程序设计所需要的几个最基本的知识：内存单元的寻址方式，变量定义和各种汇编指令格式。在掌握了这些基本内容之后，就需要学习如何把它们组成一个完整的汇编语言程序。</p>
<p>汇编语言源程序的组成部分有：模块、段、子程序和宏等。一个模块对应一个目标文件，当开发较大型的应用程序时，该程序可能由若干个目标文件或库结合而成的。有关模块和子程序的知识和宏在第7章介绍，有关宏的知识将在第9章中叙述。</p>
<hr>
<h2 id="6-1-1-段的定义"><a href="#6-1-1-段的定义" class="headerlink" title="6.1.1 段的定义"></a>6.1.1 段的定义</h2><p>微机系统的内存是分段管理的，为了与之相对应，汇编语言源程序也分若干个段来构成。8086CPU有四个段寄存器，在该系统环境下运行的程序在某个时刻最多可访问四个段，而80386及其以后的CPU都含有六个段寄存器，于是，在这些系统环境下开发的运行程序在某个时刻最多可访问六个段。</p>
<p>不论程序在某个时刻最多能访问多少个段，在编程序时，程序员都可以定义比该段数更多的段。在通常情况下，一个段的长度不能超过64K，在80386及其以后系统的保护方式下，段基地址是32位，段的最大长度可达4G。</p>
<p>段的长度是指该段所占的字节数：</p>
<ul>
<li>如果段是数据段，则其长度是其所有变量所占字节数的总和；</li>
<li>如果段是代码段，则其长度是其所有指令所占字节数的总和。</li>
</ul>
<p>在定义段时，每个段都有一个段名。在取段名时，要取一个具有一定含义的段名。</p>
<p>段定义的一般格式如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">段名 SEGMENT [对齐类型]  [组合类型]  [类别]</span><br><span class="line">… ;段内的具体内容</span><br><span class="line">…</span><br><span class="line">段名 ENDS</span><br></pre></td></tr></table></figure>
<p>其中：“段名”必须是一个合法的标识符，前后二个段名要相同。可选项“对齐类型”、“组合类型”和“类别”的说明作用请见6.3节中的叙述。</p>
<p>一个数据段的定义例子：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">DATA1  SEGMENT</span><br><span class="line"></span><br><span class="line">word1  DW        1, 9078H, ?</span><br><span class="line"></span><br><span class="line">byte1  DB        21, &apos;World&apos;</span><br><span class="line"></span><br><span class="line">       DD        12345678H</span><br><span class="line"></span><br><span class="line">DATA1  ENDS</span><br></pre></td></tr></table></figure>
<p>一个代码段的例子：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">       CODE1  SEGMENT</span><br><span class="line"></span><br><span class="line">              MOV       AX, DATA1   ;把数据段DATA1的段值送AX</span><br><span class="line"></span><br><span class="line">              MOV       DS, AX      ;把AX的值送给DS，即：DS存储数据段的段值</span><br><span class="line"></span><br><span class="line">…</span><br><span class="line"></span><br><span class="line">              MOV       AX, 4C00H</span><br><span class="line"></span><br><span class="line">              INT       21H         ;调用DOS功能，结束程序的运行</span><br><span class="line"></span><br><span class="line">       CODE1  ENDS</span><br></pre></td></tr></table></figure>
<h2 id="6-1-2-段寄存器的说明语句"><a href="#6-1-2-段寄存器的说明语句" class="headerlink" title="6.1.2 段寄存器的说明语句"></a>6.1.2 段寄存器的说明语句</h2><p>在汇编语言源程序中可以定义多个段，每个段都要与一个段寄存器建立一种对应关系。建立这种对应关系的说明语句格式如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ASSUME  段寄存器名:段名[, 段寄存器名:段名, ……]</span><br></pre></td></tr></table></figure>
<p>其中：段寄存器是CS、DS、ES、SS、FS和GS，段名是在段定义语句说明时的段名。</p>
<p>在一条ASSUME语句中可建立多组段寄存器与段之间的关系，每种对应关系要用逗号分隔。例如，</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ASSUME   CS:CODE1, DS:DATA1</span><br></pre></td></tr></table></figure>
<p>上面的语句说明了：CS对应于代码段CODE1，DS对应于数据段DATA1。</p>
<p>在ASSUME语句中，还可以用关键字NOTHING来说明某个段寄存器不与任何段相对应。下面语句说明了段寄存器ES不与某段相对应。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ASSUME   ES:NOTHING</span><br></pre></td></tr></table></figure>
<p>在通常情况下，代码段的第一条语句就是用ASSUME语句来说明段寄存器与段之间的对应关系。在代码段的其它位置，还可以用另一个ASSUME语句来改变前面ASSUME语句所说明的对应关系，这样，代码段中的指令就用最近的ASSUME语句所建立的对应关系来确定指令中的有关信息。</p>
<p><strong>例6.1 汇编语言段及其段说明语句的作用。</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">  DATA1  SEGMENT               ;定义数据段DATA1</span><br><span class="line"></span><br><span class="line">word1 DW　5678h</span><br><span class="line"></span><br><span class="line">byte1 DB　&quot;ABCDEFG&quot;</span><br><span class="line"></span><br><span class="line">       DATA1  ENDS</span><br><span class="line"></span><br><span class="line">       DATA2  SEGMENT               ;定义数据段DATA2</span><br><span class="line"></span><br><span class="line">word2 DW　1234h</span><br><span class="line"></span><br><span class="line">word3 DW　9876h</span><br><span class="line"></span><br><span class="line">       DATA2  ENDS</span><br><span class="line"></span><br><span class="line">       DATA3  SEGMENT               ;定义数据段DATA3</span><br><span class="line"></span><br><span class="line">byte2 DB　?</span><br><span class="line"></span><br><span class="line">       DATA3  ENDS</span><br><span class="line"></span><br><span class="line">       CODE1  SEGMENT               ;编写代码段CODE1</span><br><span class="line">              ASSUME    CS:CODE1, DS:DATA1, ES:DATA2        ;(1)</span><br><span class="line">              MOV       AX, DATA1   ;(2)</span><br><span class="line">              MOV       DS, AX      ;(3)</span><br><span class="line">              MOV       AX, DATA2   ;(4)</span><br><span class="line">              MOV       ES, AX      ;(5)</span><br><span class="line">…</span><br><span class="line">              MOV       AX, word1   ;访问段DATA1中的字变量word1</span><br><span class="line">              MOV       word2, AX   ;访问段DATA2中的字变量word2</span><br><span class="line">…</span><br><span class="line">              ASSUME    DS:DATA3, ES:NOTHING    ;(6)</span><br><span class="line">              MOV       AX, DATA3</span><br><span class="line">              MOV       DS, AX</span><br><span class="line">              MOV       BL, byte2   ;访问段DATA3中的字节变量byte2</span><br><span class="line">…</span><br><span class="line">              MOV       AX, 4C00H   ;(7)</span><br><span class="line">              INT       21H         ;(8)</span><br><span class="line"></span><br><span class="line">       CODE1  ENDS</span><br></pre></td></tr></table></figure>
<p>语句(1)和(6)分别说明了段和段寄存器之间的对应关系，其中语句(6)重新说明语句(1)所指定的对应关系。</p>
<p>二组语句(2)和(3)、(4)和(5)实现对段寄存器DS和ES赋初值。ASSUME说明语句只起说明作用，它不会对段寄存器赋值，所以，必须对有关段寄存器赋值。在以后的其它源程序中也都是用此方法来实现对数据段寄存器赋值的。</p>
<p>语句(7)和(8)是调用中断21H的4CH号功能来结束本程序的执行，程序的返回代码由寄存器AL来确定。结束本程序执行的指令是所有主模块必须书写的语句。</p>
<p>注意：代码段寄存器不能由程序员在源程序中对其赋值，其值是由操作系统在装入它进入系统运行时自动赋值的。</p>
<h2 id="6-1-3-堆栈段的说明"><a href="#6-1-3-堆栈段的说明" class="headerlink" title="6.1.3 堆栈段的说明"></a>6.1.3 堆栈段的说明</h2><p>堆栈段是一个特殊的段，在程序中可以定义它，也可以不定义。除了要生成COM型执行文件的源程序外，一个完整的源程序一般最好定义堆栈段。如果在程序中不定义堆栈段，那么，操作系统在装入该执行程序时将自动为其指定一个64K字节的堆栈段。</p>
<p>在程序没有定义堆栈段的情况下，在由连接程序生成执行文件时，将会产生一条如下的警告信息，但程序员可以不理会它，所生成的执行文件是可以正常运行的。</p>
<p>warning xxxx: no stack segment  (其中：xxxx是错误号)</p>
<p>在源程序中，可用以下方法来定义堆栈段。</p>
<p><strong>方法1：</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">STACK1 SEGMENT</span><br><span class="line"></span><br><span class="line">DB　256 DUP(?)?;256是堆栈的长度，可根据需要进行改变 </span><br><span class="line"></span><br><span class="line">TOP LABEL?WORD</span><br><span class="line"></span><br><span class="line">STACK1 ENDS</span><br></pre></td></tr></table></figure>
<p>以上堆栈段的定义如图6.1所示。由于堆栈是按地址从大到小的存储单元顺序来存放内容的，所以，在堆栈存储单元说明语句之后，再说明一个栈顶别名，这样，对栈顶寄存器SP的赋值就很方便。</p>
<p>在源程序的代码段中，还要添加如下程序段，才能把段STACK1当作堆栈段来使用。</p>
<p><img src="http://www.iteedu.com/plang/asm/asmhbyychxshj/images/clip_image002_0024.gif" alt></p>
<center><strong>图6.1 堆栈段定义示意图</strong></center>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">…</span><br><span class="line"></span><br><span class="line">ASSUME SS:STACK1 ;可在代码段的段指定语句中一起说明</span><br><span class="line"></span><br><span class="line">CLI ;禁止响应可屏蔽中断</span><br><span class="line"></span><br><span class="line">MOV AX, STACK1</span><br><span class="line"></span><br><span class="line">MOV SS, AX</span><br><span class="line"></span><br><span class="line">MOV SP, offset TOP ;给堆栈段的栈顶寄存器SP赋初值</span><br><span class="line"></span><br><span class="line">STI ;恢复响应可屏蔽中断</span><br><span class="line"></span><br><span class="line">…</span><br></pre></td></tr></table></figure>
<p><strong>方法2：</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">STACK1 SEGMENT　STACK ;定义一个堆栈段，其段名为STACK1</span><br><span class="line"></span><br><span class="line">DB　256 DUP(?)</span><br><span class="line"></span><br><span class="line">STACK1 ENDS</span><br></pre></td></tr></table></figure>
<p>上述段定义说明了该段是堆栈段，系统会自动把段寄存器SS和栈顶寄存器SP与该堆栈段之间建立相应的关系，并设置其初值，而不用在代码段对它们进行赋值。</p>
<p>除了以上二种方法外，还有一种更简洁的方法来定义堆栈段，有关内容请见第6.4.2节中的叙述。</p>
<h2 id="6-1-4-源程序的结构"><a href="#6-1-4-源程序的结构" class="headerlink" title="6.1.4 源程序的结构"></a>6.1.4 源程序的结构</h2><p>下面的程序是一个完整的源程序，其功能是在屏幕上显示字符串“Hello, World.”。读者可参考此结构编写自己的简单程序。</p>
<p><strong>例6.2 在屏幕上显示字符串“HELLO，WORLD.”</strong></p>
<p>解：可运行下面的控件，用鼠标左键单击程序中的某一行，可阅读其含义；单击“内存”可切换内存内容的显示方式。</p>
<p>伪指令END表示源程序到此为止，汇编程序对该语句之后的任何内容都不作处理，所以，通常情况下，伪指令END是源程序的最后一条语句。</p>
<p>伪指令END后面可附带一个在程序中已定义的标号，由该标号指明程序的启动位置。</p>
<p>如果源程序是一个独立的程序或主模块，那么，伪指令END后面一定要附带一个标号；如果源程序仅是一个普通模块，那么，其END后面就一定不能附带标号。</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/limh/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/limh/2015/04/01/asm22/" rel="next" title="5.2 指令系统">
                <i class="fa fa-chevron-left"></i> 5.2 指令系统
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/limh/2015/04/01/asm24/" rel="prev" title="6.2 程序的基本结构">
                6.2 程序的基本结构 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/limh/images/avatar.jpg" alt="土逗牛肉">
            
              <p class="site-author-name" itemprop="name">土逗牛肉</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/limh/archives/">
              
                  <span class="site-state-item-count">255</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/limh/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/limh/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/limhGeek" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:1591054297@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/f73b243e7cc9" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-user-circle-o"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#6-1-1-段的定义"><span class="nav-number">1.</span> <span class="nav-text">6.1.1 段的定义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-1-2-段寄存器的说明语句"><span class="nav-number">2.</span> <span class="nav-text">6.1.2 段寄存器的说明语句</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-1-3-堆栈段的说明"><span class="nav-number">3.</span> <span class="nav-text">6.1.3 堆栈段的说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-1-4-源程序的结构"><span class="nav-number">4.</span> <span class="nav-text">6.1.4 源程序的结构</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">土逗牛肉</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
	var str = GetUrlParam('height');
    if (str === '0'){
		document.getElementById('header').style.display = 'none';
		document.getElementById('comments').style.display = 'none';
		document.getElementById('footer').style.display = 'none';
		document.getElementsByClassName('post-footer').item(0).style.display = 'none'
	}
	
    function GetUrlParam(paraName) {
        var url = document.location.toString();
        var arrObj = url.split("?");

        if (arrObj.length > 1) {
            var arrPara = arrObj[1].split("&");
            var arr;

            for (var i = 0; i < arrPara.length; i++) {
                 arr = arrPara[i].split("=");

                if (arr != null && arr[0] === paraName) {
                    return arr[1];
                }
            }
            return "";
        } else {
            return "";
        }
    }
</script>









  












  
  
    <script type="text/javascript" src="/limh/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/limh/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/limh/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/limh/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/limh/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/limh/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
